Multiple Patches in a File

Contents|Index|Previous|Next

Multiple Patches in a File

If the patch file contains more than one patch, patch tries to apply each of them as if they came from separate patch files. This means that it determines the name of the file to patch for each patch, and that it examines the leading text before each patch for file names and prerequisite revision level (see Tips for Making Patch Distributions for more on that topic). For the second and subsequent patches in the patch file, you can give options and another original file name by separating their argument lists with a '+'. However, the argument list for a second or subsequent patch may not specify a new patch file, since that does not make sense. For example, to tell patch to strip the first three slashes from the name of the first patch in the patch file and none from subsequent patches, and to use 'code.c' as the first input file, you can use: patch -p3 code.c + -p0 < patchfile.

The '-S' or'--skip' option ignores the current patch from the patch file, but continue looking for the next patch in the file. Thus, to ignore the first and third patches in the patch file, you can use: patch -S + + -S + < patch file.